package adventure.misc;

/**
 *
 * @author Michael Hanns
 * 
 */
public class CurrencyImp implements Currency, CurrencyEdit {

    private String statusID;
    private String singular;
    private String plural;
    private String singularDark;
    private String pluralDark;

    public CurrencyImp() {
        this.statusID = "Gold";
        this.singular = "gold coin";
        this.plural = "gold coins";
        this.singularDark = "something";
        this.pluralDark = "a pile of something";
    }

    public CurrencyImp(String statusID, String singular, String plural,
            String singularDark, String pluralDark) {
        this.statusID = statusID;
        this.singular = singular;
        this.plural = plural;
        this.singularDark = singularDark;
        this.pluralDark = pluralDark;
    }

    @Override
    public void setStatusID(String statusID) {
        this.statusID = statusID;
    }

    @Override
    public void setSingular(String singular) {
        this.singular = singular;
    }

    @Override
    public void setPlural(String plural) {
        this.plural = plural;
    }

    @Override
    public void setSingularInDark(String singularDark) {
        this.singularDark = singularDark;
    }

    @Override
    public void setPluralInDark(String pluralDark) {
        this.pluralDark = pluralDark;
    }

    @Override
    public String getStatusID() {
        return statusID;
    }

    @Override
    public String getSingular() {
        return singular;
    }

    @Override
    public String getPlural() {
        return plural;
    }

    @Override
    public String getSingularInDark() {
        return singularDark;
    }

    @Override
    public String getPluralInDark() {
        return pluralDark;
    }

    // Returns true if command referencing the currency
    // Checks if it's looking at dark reference or normal reference
    // And says it is referencing if the commmand ends with a substring
    // of the gold
    @Override
    public boolean isReferencingCurrency(String cmd, boolean dark) {
        cmd = cmd.toLowerCase();

        if (!dark) {
            if (cmd.endsWith(singular.toLowerCase())) {
                return true;
            } else if (cmd.endsWith(plural.toLowerCase())) {
                return true;
            } else if (cmd.endsWith(statusID.toLowerCase())) {
                return true;
            }
        } else {
            if (!dark) {
                if (cmd.endsWith(singularDark.toLowerCase())) {
                    return true;
                } else if (cmd.endsWith(pluralDark.toLowerCase())) {
                    return true;
                }
            }
        }

        return false;
    }
}
